#include <iostream>
#include <string>

using namespace std;

class complex
{
    double real, img;

public:

    complex(double real=0, double img=0): real(real), img(img) {}

    friend complex add(const complex& c, const complex& d);

    string toString() { return "(" + to_string(real) + ", " + to_string(img) + ")"; }

};

complex add(const complex& c, const complex& d)
{
    complex x;
    x.img = c.img + d.img;
    x.real = c.real + d.real;
    return x;
}

int main()
{
    complex c1 = {1,2}, c2 = {5, 8};
    cout << add(c1, c2).toString() << endl;
    return 0;
}